#include <stdlib.h>
#include <stdio.h>

int main()
{
    int N;
    scanf("%d", &N);
    int *a = 0;
    a = (int *)malloc(N * sizeof(int));
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &a[i]);
    }
    int A1 = 0, A2 = 0;
    double A3 = 0;
    int cnt2 = 0, cnt3 = 0;
    double sum3 = 0.0;
    for (int i = 0; i < N; i++)
    {
        if(a[i] % 3 == 0)
        {
            if (a[i] > A1)
            {
                A1 = a[i];
            }
        }
        if ((a[i] - 1) % 3 == 0)
        {
            cnt2++;
        }
        if ((a[i] - 2) % 3 == 0)
        {
            cnt3++;
            sum3 += a[i];
        }
    }
    A2 = cnt2;
    if (cnt3 > 0)
    {
        A3 = sum3 / cnt3;
    }
    if (A1 == 0)
    {
        printf("NONE ");
    }
    else
    {
        printf("%d ", A1);
    }
    if (A2 == 0)
    {
        printf("NONE ");
    }
    else
    {
        printf("%d ", A2);
    }
    if (cnt3 == 0)
    {
        printf("NONE");
    }
    else
    {
        printf("%.1f", A3);
    }
    
    free(a);

    return 0;
}